from openai import OpenAI

api_key = 'hk-xxx'
def main():
    # 实例化客户端
    client = OpenAI(api_key=api_key,
                    base_url="https://api.openai-hk.com/v1/")
    # 调用 GPT-4o-mini 模型
    # response = client.chat.completions.create(
    #     model="gpt-4o-mini",
    #     messages=[
    #         {"role": "user", "content": "你好，好久不见!"}
    #     ]
    # )
    # 输出生成的响应内容
    # print(response.choices[0].message.content)

    models_list = client.models.list()
    print(models_list.data)


if __name__ == "__main__":
    main()
